home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWPictur.h < prev    next >
Encoding:
Text File  |  1996-04-25  |  3.4 KB  |  123 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWPictur.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWPICTUR_H
  11. #define FWPICTUR_H
  12.  
  13. #ifndef FWGRREF_H
  14. #include "FWGrRef.h"
  15. #endif
  16.  
  17. #ifndef SLPICTUR_H
  18. #include "SLPictur.h"
  19. #endif
  20.  
  21. #ifndef FWGC_H
  22. #include "FWGC.h"
  23. #endif
  24.  
  25. //========================================================================================
  26. //    Forward Class Declarations
  27. //========================================================================================
  28.  
  29. class FW_CPictureContext;
  30. class FW_PResourceFile;
  31. class FW_CWritableStream;
  32. class FW_CReadableStream;
  33.  
  34. //========================================================================================
  35. //    class FW_CPicture
  36. //========================================================================================
  37.  
  38. class FW_CPicture : public FW_TGrRefPtr<FW_HPicture>
  39. {
  40. public:
  41.     FW_DECLARE_AUTO(FW_CPicture)
  42.  
  43.     FW_CPicture();
  44.     ~FW_CPicture();
  45.     
  46.     FW_CPicture(FW_PlatformPict platformPict); // Does not adopt the picture
  47.     FW_CPicture(FW_PResourceFile& resourceFile, FW_ResourceId resourceId);
  48.     FW_CPicture(FW_CReadableStream& stream);
  49.  
  50.     FW_CPicture(const FW_CPicture& other);
  51.     FW_CPicture& operator=(const FW_CPicture& other);
  52.  
  53.     FW_CPicture Copy() const;
  54.  
  55.     friend FW_CWritableStream& operator << (FW_CWritableStream& stream, const FW_CPicture& picture);
  56.     friend FW_CReadableStream& operator >> (FW_CReadableStream& stream, FW_CPicture& picture);
  57.  
  58.     // ----- Delegation
  59.     
  60.     FW_Boolean            IsEqual(const FW_CPicture& picture) const
  61.                             { return FW_PrivPicture_IsEqual(fRep, picture.fRep); }
  62.  
  63.     void                GetPictBounds(FW_SRect& bounds) const
  64.                             { FW_PrivPicture_GetPictBounds(fRep, bounds); }
  65.  
  66.     void                 GetPictBounds(FW_SGraphicContext& gc, FW_SRect& bounds) const;
  67.     
  68.     FW_PlatformPict        GetPlatformPict() const
  69.                             { return FW_PrivPicture_GetPlatformPict(fRep); }
  70.         
  71.     FW_Boolean            IsPlatformPictOrphan() const
  72.                             { return FW_PrivPicture_IsPlatformPictOrphan(fRep); }
  73.         
  74.     FW_PlatformPict        OrphanPlatformPict() const
  75.                             { return FW_PrivPicture_OrphanPlatformPict(fRep); }
  76.         
  77.     void                SetPlatformPict(FW_PlatformPict newPict)
  78.                             { FW_PrivPicture_SetPlatformPict(fRep, newPict); }
  79.         
  80.     void                AdoptPlatformPict(FW_PlatformPict newPict)
  81.                             { FW_PrivPicture_AdoptPlatformPict(fRep, newPict); }
  82.     
  83. #ifdef FW_BUILD_MAC
  84.     void                MacLock()
  85.                             { FW_FailOnError(FW_PrivPicture_MacLock(fRep)); }
  86.         
  87.     void                MacUnlock()
  88.                             { FW_FailOnError(FW_PrivPicture_MacUnlock(fRep)); }
  89. #endif
  90. };
  91.  
  92. //========================================================================================
  93. //    class FW_CPictureContext
  94. //========================================================================================
  95.  
  96. class FW_CPictureContext : public FW_CGraphicContext
  97. {
  98. public:
  99.     FW_DECLARE_AUTO(FW_CPictureContext)
  100. public:
  101.     FW_CPictureContext(Environment* ev,
  102.                        FW_CPicture& picture,
  103.                        FW_Fixed xSize,
  104.                        FW_Fixed ySize);
  105.                                            // Size is in 72dpi
  106.     virtual ~FW_CPictureContext();
  107.  
  108.     virtual void        Reset();
  109.  
  110. protected:
  111.     ODShape*            PrivAcquireClipShape(Environment* ev);
  112.     
  113. private:
  114.     FW_CPicture&         fPicture;        // A reference because will modify the ref-cnt pointer
  115.     FW_HGDevice            fGraphicDevice;
  116.     
  117. #ifdef FW_BUILD_MAC
  118.     PicHandle             fMacPictHandle;
  119. #endif
  120. };
  121.  
  122. #endif
  123.